// components/tabbar/tabbar.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    selected: 0,
    color: "#bdb9b9",
    selectedColor: "#FBE802",
    list: [{
      pagePath: "/pages/dish/index/index",
      iconPath: "/lib/icon/shouye.png",
      selectedIconPath: "/lib/icon/shouye-1.png",
      text: "商城首页"
    }, {
      pagePath: "/pages/dish/dish",
      iconPath: "/lib/icon/fenlei.png",
      selectedIconPath: "/lib/icon/fenlei-1.png",
      text: "分类"
    }, {
      pagePath: "/pages/dish/cart/cart",
      iconPath: "/lib/icon/gouwuche.png",
      selectedIconPath: "/lib/icon/gouwuche-1.png",
      text: "购物车"
    }, {
      pagePath: "/pages/dish/myorder/myorder",
      iconPath: "/lib/icon/dingdan.png",
      selectedIconPath: "/lib/icon/dingdan-1.png",
      text: "我的订单"
    }]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({
        url
      })
      this.setData({
        selected: data.index
      });
    }
  }
})